package com.ebupt.migu.music.strategy.controller;

import com.ebupt.migu.music.common.entity.ResultObject;
import com.ebupt.migu.music.strategy.entity.StrategyDTO;
import com.ebupt.migu.music.strategy.entity.StrategyInfo;
import com.ebupt.migu.music.strategy.service.ProvinceStrategyService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * Description: 分省运营策略管理操作
 *
 * @author lemon
 * @since 2022-09-14 11:05
 */
@RestController
@RequestMapping("/provinceStrategy")
public class ProvinceStrategyController {

    @Resource
    private ProvinceStrategyService provinceStrategyService;

    /**
     * 查询短信下发状态
     *
     * @param strategyDTO 查询条件
     * @return 短信下发状态集
     */
    @PostMapping("/queryMessageStatus")
    public ResultObject<List<StrategyInfo>> queryMessageIssuedStatus(@RequestBody StrategyDTO strategyDTO) {
        return provinceStrategyService.queryMessageIssuedStatus(strategyDTO);
    }

    /**
     * 短信策略创建
     *
     * @param strategyInfo 策略信息
     * @return 创建结果
     */
    @PostMapping("/addStrategy")
    public ResultObject<String> addMessageStrategy(@RequestBody StrategyInfo strategyInfo) {
        return provinceStrategyService.addMessageStrategy(strategyInfo);
    }
}
